Release 10.1A: OpenEdge Development:
Programming Interfaces
Reading and writing data
Once you have initialized a
Note: Before setting or getting values in aMEMPTRvariable, you can build a data aggregate (structure) or access an existing structure in the associated memory region using several memory-writing statements and memory-reading functions. Memory-writing statements write values to specified locations in the memory region. Memory-reading functions return values from the specified locations in the memory region. Through an appropriate choice of these statements and functions you can thus copy Progress data types and bit fields to and fromMEMPTRvariables. You can also copy complete Progress database records to and fromMEMPTRvariables.MEMPTRvariable, you might want to check theMEMPTRsize using theGET-SIZEfunction. For more information, see the "Initializing and uninitializing MEMPTR variables" section.This is the syntax for the
MEMPTRmemory-writing statements (exceptPUT-STRING):
This is the syntax for the
MEMPTRmemory-reading functions (exceptGET-STRINGandGET-BYTES):
Each
PUT-datatypestatement writes a value (expression) of a certain data type to the memory region associated with theMEMPTRvariablemptr-nameat the specifiedbyte-position. EachGET-datatypefunction reads and returns the value of a data type from the memory region associated with theMEMPTRvariablemptr-nameat the specifiedbyte-position. Thebyte-positionin these statements and functions is specified by an integer expression that starts at one (1).The
Note: ThePUT-STRINGstatement andGET-STRINGfunction each allow an additional optional parameter that specifies the number of bytes to write or read in theMEMPTRvariable. TheGETBYTESfunction has the same parameter, but it is required for this function.mptr-nameparameter in these statements and functions can referenceRAWas well asMEMPTRvariables. However, the EPIs that requireMEMPTRvariables cannot useRAWvariables directly. You must convertRAWvalues toMEMPTRbefore using them with these EPIs. You can do this using direct assignment betweenRAWandMEMPTRvariables or by using statements and functions such asPUT-BYTES,GET-BYTES, orGET-RAW.Memory-writing statements
Progress provides the
PUT-datatypestatements shown in Table 8–1.
For more information on these statements, see the OpenEdge Development: Progress 4GL Reference .
Memory-reading functions
Progress provides the
GET-datatypefunctions shown in Table 8–2.
For more information on these functions, see the OpenEdge Development: Progress 4GL Reference .
Copying between basic Progress data types and MEMPTR
Table 8–3 lists the basic Progress data types and how you can copy them in and out of a
MEMPTRvariable.
Table 8–3: Copying between basic Progress data types
and MEMPTR Data type Copying to/from MEMPTR To copy into aMEMPTR:To copy from aMEMPTR: DECIMAL1 To copy into aMEMPTR:To copy from aMEMPTR: INTEGER1 To copy into aMEMPTR:To copy from aMEMPTR: LOGICAL1 To copy into aMEMPTR:To copy from aMEMPTR: To copy into aMEMPTR:To copy from aMEMPTR:
1The choice of exact statement or function to use depends on the data type used by the shared library routine or the socket application with your application is communicating.
Manipulating bit values
You can copy bit values up to the size of a Progress
INTEGERfrom oneINTEGERvalue to another. The statement to copy bit values to anINTEGERvariable,PUT-BITS, has the following syntax:
This statement interprets an integer (
integer-expression) as the sequence of bits representing the binary value ofinteger-expression. For example, if the value ofinteger-expressionis 22, the bit sequence is 10110. The statement interprets theINTEGERvariable,destination, as a sequence of bits and writes the sequence of bits frominteger-expressionintodestination, starting at the specified bit position (start-position) The bit position indestinationis counted from the low-order bit, where the first bit is bit one (1). If the value ofinteger-expressionis too large to store in the specified number of bits, Progress stores the low-ordercountbits ofinteger-expressionin the specifiedcountbits withindestination.The function to return some number of bits from an
INTEGERvariable,GET-BITS, has the following syntax:
This function returns the
INTEGERthat represents the value of the number of bits specified bycountstarting at the specified low-order bit position (start-position) within theINTEGERvariable specified bysource.Thus, you can store bit values in
MEMPTRvariables and return bit values fromMEMPTRvariables by using thePUT-LONGstatement andGET-LONGfunction to store and return the correspondingINTEGERexpression that contains the bit pattern.Copying between database records and MEMPTR
Copying a database record to and from a
MEMPTRvariable relies on theRAW-TRANSFERstatement. This statement allows you to copy a whole database record buffer to aRAWvariable or to copy aRAWvariable to a database record buffer.
![]()
To store a database record in a
MEMPTRvariable:
![]()
To retrieve a database record from a
MEMPTRvariable:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |